/*
 * @Author: wangqizhang
 * @Date: 2024-04-26 15:13:15
 * @LastEditors: wangqizhang
 * @LastEditTime: 2024-05-12 16:33:07
 * @FilePath: /suixinji-server/controller/user.controller.js
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
const bcrypt = require('bcrypt');
const { createUser, userlogin } = require('../service/user.service');
const { dealResponse } = require('../until');
//辅助函数判断用户是否存在

//辅助函数判断数据是否正确
class UserController {
  async register(ctx, next) {
    //校验数据
    const { user_name, pass_word } = ctx.request.body;
    //创建用户
    const res = await createUser({ user_name, pass_word });
    dealResponse(ctx, res);
  }

  async login(ctx, nex) {
    const res = await userlogin(ctx.request.body);
    dealResponse(ctx, res);
  }
}
module.exports = new UserController();
